<template>
  <div>
    <table class="table1" width="100%" cellspacing="0">
      <tr>
        <th>方案名称</th>
        <td><input v-model="obj.name" type="text" placeholder="请输入"></td>
      </tr>
      <tr>
        <th>附件上传</th>
        <td>
          <wise-file v-model="obj.fileUrl" upload-type="file" accept=".doc,.pdf" :limit="6" />
        </td>
      </tr>
    </table>
    <table class="table1" width="100%" cellspacing="0">
      <tr>
        <th class="title">编号</th>
        <th><input v-model="obj.serialNumber" type="text" placeholder="请输入"></th>
      </tr>

      <tr class="noborder">
        <th class="title">一、施工组织</th>
        <th class="noborder">
          <tr class="noborder">
            <table border="0" class="table1" width="100%" cellspacing="0">
              <tr class="noborder">
                <th>动火申请单位</th>
                <td class="noborder">
                  <input v-model="obj.hotApplyUnit" type="text" placeholder="请输入">
                </td>
              </tr>
            </table>
          </tr>
          <tr class="noborder">
            <table class="table1" width="100%" cellspacing="0">
              <tr class="noborder">
                <th>动火作业时间</th>
                <td style="width:100%">
                  <div class="block">
                    <el-date-picker
                      v-model="value1"
                      type="datetimerange"
                      value-format="timestamp"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      @change="timeChange"
                    />
                  </div>
                </td>
              </tr>
            </table>

          </tr>
          <tr class="noborder">
            <table class="table1" width="100%" cellspacing="0">
              <tr class="noborder">

                <th>基层站场（作业区）负责人</th>
                <td>
                  <input v-model="obj.workAdminUserName" type="text" placeholder="请输入">
                </td>
                <th>
                  动火作业级别
                </th>
                <td>
                  <input v-model="obj.hotLevel" type="text" placeholder="请输入">
                </td>
              </tr>
            </table>

          </tr>
          <tr class="noborder">
            <table class="table1" width="100%" cellspacing="0">
              <tr>
                <th>动火作业地点</th>
                <td>
                  <input v-model="obj.hotPlace" type="text" placeholder="请输入">
                </td>
              </tr>
            </table>
          </tr>
          <tr class="noborder">
            <table border="0" class="table1" width="100%" cellspacing="0">

              <tr class="noborder">
                <th>动火作业单位负责人</th>
                <td class="noborder">
                  <!-- <el-select v-model="obj.hotWorkUnitAdmin" placeholder="请选择">
                <el-option v-for="item in options" :key="item.userId" :label="item.username" :value="item.userId">
                </el-option>
              </el-select> -->
                  <input v-model="obj.hotWorkUnitAdmin" type="text" placeholder="请输入">
                </td>
                <th>
                  动火作业单位监护人
                </th>
                <td class="noborder">
                  <!-- <el-select v-model="obj.hotWorkUnitGuardian" placeholder="请选择">
                <el-option v-for="item in options" :key="item.userId" :label="item.username" :value="item.userId">
                </el-option>
              </el-select> -->
                  <input v-model="obj.hotWorkUnitGuardian" type="text" placeholder="请输入">
                </td>
              </tr>
            </table>
          </tr>
        </th>
      </tr>
      <tr>
        <th class="title">二、动火作业内容及目的</th>
        <th>
          <textarea id="" v-model="obj.hotContent" name="" placeholder="请输入" />
        </th>
      </tr>
    </table>
    <table width="100%" cellspacing="0">
      <tr>
        <th />
        <th class="title"> 三、动火作业部位与周围油气流程及置换隔断示意图（管线要注明介质、尺寸，控制流程中的阀门要编号，由动火申请单位绘制，生产部门审核）</th>
      </tr>
      <tr class="noborder">
        <th />
        <th class="noborder">
          <wise-file v-model="obj.sketchMap" upload-type="image" :limit="6" />
        </th>
      </tr>
      <tr align="right" class="noborder">
        <th />
        <th class="noborder">
          <td class="noborder">绘制：<input type="text" class="input" placeholder="请输入"></td>
        </th>
        </th>
      </tr>
      <tr align="right" class="noborder">
        <th />
        <th class="noborder">
          <td class="noborder">审核：<input type="text" class="input" placeholder="请输入"></td>
        </th>
      </tr>
      <tr align="center" class="noborder">
        <th />
        <th class="noborder">
          <td class="noborder">（特级、一级由生产科工艺设备管理人员审核，二级由作业区工艺技术员审核）</td>
        </th>
      </tr>
      <tr />
      <tr>
        <th />
        <th class="title"> 四、动火作业安全技术措施及现场施工组织（内容较多时可另加纸）（内容参见附录C.1）</th>
      </tr>
      <tr>
        <th />
        <th>
          <textarea v-model="obj.measure" style="width:100%" placeholder="请输入" />

        </th>
      </tr>
      <tr class="noborder borderTop">
        <th class="noborder" />
        <th class="title noborder">五、动火作业单位审查意见（负责人）</th>
      </tr>
      <tr class="noborder">
        <th class="noborder" />
        <th class="noborder">
          <div />
        </th>
      </tr>
      <tr align="right" class="noborder">
        <th class="noborder" />
        <th class="noborder">
          <td class="noborder">
            <div class="min-width240">
              签字:
              <el-select v-model="obj.hotWorkUnitAdminUserId" placeholder="请选择">
                <el-option v-for="item in options" :key="item.userId" :label="item.username" :value="item.userId" />
              </el-select>
            </div>
          </td>
        </th>
      </tr>
      <tr align="right" class="noborder">
        <th class="noborder" />
        <th class="noborder">
          <td class="noborder">
            <div class="min-width240">
              时间:
              <input type="text" class="input" placeholder="请输入时间">
            </div>
          </td>

        </th>
      </tr>
      <tr class="noborder borderTop">
        <th class="noborder" />
        <th class="title noborder">六、作业区域所在基层单位审查意见： </th>
      </tr>
      <tr class="noborder">
        <th class="noborder" />
        <th class="noborder">
          <div />
        </th>
      </tr>
      <tr align="right" class="noborder">
        <th class="noborder" />
        <th class="noborder">
          <td class="noborder">
            <div class="min-width240">
              签字:
              <el-select v-model="obj.basicUnitAdminUserId" placeholder="请选择">
                <el-option v-for="item in options" :key="item.userId" :label="item.username" :value="item.userId" />
              </el-select>
            </div>
          </td>
        </th>
      </tr>
      <tr align="right" class="noborder">
        <th class="noborder" />
        <th class="noborder">
          <td class="noborder">
            <div class="min-width240">
              时间:
              <input type="text" class="input" placeholder="请输入时间">
            </div>

          </td>
        </th>
      </tr>
    </table>
    <table width="100%" cellspacing="0">
      <tr class="noborder">
        <th class="textTop">
          七、二级单位业务主管部门审查意见
        </th>
        <th class="noborder">
          <p>生产调度运行部门：</p>
          <tr class="noborder">
            <textarea id="" name="" cols="10" rows="3" />
          </tr>
          <tr class="noborder">
            <td align="left" class="noborder">
              签字: <el-select v-model="obj.twoProductionAdminUserId" placeholder="请选择">
                <el-option v-for="item in options" :key="item.userId" :label="item.username" :value="item.userId" />
              </el-select>
            </td>
          </tr>
          <tr class="noborder">
            <td align="right" class="noborder">
              时间: <input type="text" class="input1" placeholder="请输入">
            </td>
          </tr>
        </th>
        <th>
          <p>资产设施管理部门（生产、管道或工程）：</p>
          <tr class="noborder">
            <textarea id="" name="" cols="10" rows="3" />
          </tr>
          <tr class="noborder">
            <td align="left" class="noborder">
              签字: <el-select v-model="obj.towAssetsAdminUserId" placeholder="请选择">
                <el-option v-for="item in options" :key="item.userId" :label="item.username" :value="item.userId" />
              </el-select>
            </td>
          </tr>
          <tr class="noborder">
            <td align="right" class="noborder">
              时间: <input type="text" class="input1" placeholder="请输入">
            </td>
          </tr>
        </th>
        <th>
          <p>安全监管部门：</p>
          <tr class="noborder">
            <textarea id="" name="" cols="10" rows="3" />
          </tr>
          <tr class="noborder">
            <td align="left" class="noborder">
              签字: <el-select v-model="obj.twoSafetyAdminUserId" placeholder="请选择">
                <el-option v-for="item in options" :key="item.userId" :label="item.username" :value="item.userId" />
              </el-select>
            </td>
          </tr>
          <tr class="noborder">
            <td align="right" class="noborder">
              时间: <input type="text" class="input1" placeholder="请输入">
            </td>
          </tr>
        </th>
      </tr>
    </table>
    <table width="100%" cellspacing="0">
      <tr class="noborder">
        <th class="noborder" />
        <th class="title textTop noborder borderTop">八、二级单位主管领导： </th>
      </tr>
      <tr align="right" class="noborder">
        <th class="noborder" />
        <th class="noborder">
          <td class="noborder">
            <div class="min-width240">
              签字:
              <el-select v-model="obj.leaderAdminUserId" placeholder="请选择">
                <el-option v-for="item in options1" :key="item.userId" :label="item.username" :value="item.userId" />
              </el-select>
            </div>
          </td>
        </th>
      </tr>
      <tr align="right" class="noborder">
        <th class="noborder" />
        <th class="noborder">
          <td class="noborder">
            <div class="min-width240">
              时间:
              <input type="text" class="input" placeholder="请输入时间">
            </div>
          </td>
        </th>
      </tr>
    </table>
    <div class="botDesc">
      <p>保存单位：动火单位</p>
      <p>保存期限：一年</p>
    </div>
    <div>
      <el-button type="primary" @click="submitHandle">确认</el-button>
      <el-button>重置</el-button>
    </div>
  </div>
</template>

<script>
import {
  postHandle
} from '@/api'
import WiseFile from '@/components/Crud/components/wiseFile'
export default {
  components: {
    WiseFile
  },
  props: ['object'],
  data() {
    return {
      obj: {
        name: '',
        fileUrl: null,
        'serialNumber': '',
        'hotApplyUnit': '',
        'hotWorkStartTime': '',
        'hotWorkEndTime': '',
        'workAdminUserName': '',
        'hotLevel': '',
        'hotPlace': '',
        'hotWorkUnitAdmin': '',
        'hotWorkUnitGuardian': '',
        'hotContent': '',
        'hotWorkUnitAdminUserId': '',
        'basicUnitAdminUserId': '',
        'twoProductionAdminUserId': '',
        'towAssetsAdminUserId': '',
        'twoSafetyAdminUserId': '',
        'leaderAdminUserId': '',
        sketchMap: '',
        measure: ''
      },
      dialogVisible: false,
      userList: '/api/v1/welder-uac-second/space-user-member-role-comb/get-user-info-by-roles',
      jituanList: '/api/v1/welder-sbtx-second/hot-approval-comb/list',
      addUrl: '/api/v1/welder-sbtx-second/hot-program-comb/create',
      options: '',
      options1: [],
      value: '',
      value1: []
    }
  },
  computed: {
    spaceId() {
      return this.$store.getters.entSpaceId
    }
  },
  created() {
    this.obj = this.object
    this.value1.push(this.object.hotWorkStartTime, this.obj.hotWorkEndTime)
    this.getOptionsItems()
    this.getEntAdminData()
  },
  methods: {
    getOptionsItems() {
      let params = {
        d: {
          c: [{
            'key': 'authToken',
            'value': this.$store.getters.token
          },
          {
            'key': 'entSpaceId',
            'value': this.$store.getters.entSpaceId
          }
          ]
        },
        'obj': {
          'roleCodes': ['formalEmployee'],
          'spaceId': this.spaceId,
          'spaceProperty': 1
        }
      }
      if (this.userList) {
        postHandle(this.userList, params).then(res => {
          this.options = res.result
        })
      }
    },
    // 企业管理元

    getEntAdminData() {
      postHandle('/api/v1/welder-uac-second/space-user-member-role-comb/get-ent-admin/' + this.spaceId).then(res => {
        this.options1 = res.result
      })
    },
    submitHandle() {
      this.drawer = false
      if (this.addUrl) {
        postHandle(this.addUrl, {
          obj: this.obj
        }).then(res => {
          if (res._rd) {
            this.$message({
              message: '创建成功',
              type: 'success'
            })
            this.$emit('hideDijon', false)
          }
        })
      }
    },
    timeChange(a) {
      this.obj.hotWorkStartTime = a[0]
      this.obj.hotWorkEndTime = a[1]
    }
  }
}
</script>

<style scoped>
  table {
    border-collapse: collapse;
  }

  table,
  table tr,
  table tr th {
    line-height: 41px;
    border: 1px solid #000000;
    vertical-align: top;
  }

  .title {
    text-align: left;
    line-height: 40px;
  }

  input {
    border: none;
    width: 100%;
    height: 100%;
    outline: none;
    padding-left: 20px;
    height: 30px;
    color: rgb(126, 126, 126);
    font-weight: bold;
  }

  .table1 tr th {
    min-width: 200px;

  }

  textarea {
    border: none;
    outline: none;
    padding: 10px;
    resize: none;
    width: 100%;
    min-height: 100px;
    color: rgb(126, 126, 126);
    font-weight: bold;
  }

  .input {
    width: 200px;
  }

  .input1 {
    width: 150px;
  }

  .noborder {
    border: none;
  }

  .borderTop {
    border-top: 1px solid #000000;
  }

  .textTop {
    vertical-align: top;
  }

  select {
    width: 100%;
    height: 30px;
    margin: 15px 10px;
    color: rgb(126, 126, 126);
    font-weight: bold;
  }

  .width40 {
    width: 40%
  }

  .botDesc {
    padding-top: 10px;
    padding-left: 100px;
  }

  .botDesc p {
    line-height: 40px;
  }

  .qianzi {
    width: 180px
  }

  .qianzi1 {
    width: 130px
  }

  .el-select {
    width: 140px
  }

  .upload {

    /* height: 40px; */
  }

  /deep/ .el-upload--picture-card {
    margin: 10px;
    /* height: 100%; */
    /* line-height: 50px; */
  }

  /deep/ .el-upload-list--picture-card .el-upload-list__item {
    margin: 10px;
  }

  .min-width240 {
    min-width: 240px;
    text-align: left
  }
</style>
